/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.io.FileNotFoundException;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;

/**
 *
 * @author Admin
 */
public class Main {

    public static void main(String[] args) throws FileNotFoundException, ParserConfigurationException, SAXException, IOException {
        String FileName = "nguoivietnamchau.xml"; //ten file xml
        String loai = "div"; // loai cau truc [div] hay [li]
        VNExpressXPath xp = new VNExpressXPath(FileName, loai);
        int n = xp.Count();
        System.out.println(n);
        for (int i = 1; i <= n; i++) {
            try {

                xp = new VNExpressXPath(FileName, i + "", loai);
                String tt = xp.getTitle().trim();
                if (tt != null) {
                    System.out.println("================================================");
                    System.out.println("[Tin Thu: " + i + "]" + tt);
                    System.out.println("----Date: " + xp.getDate().trim());
                    System.out.println("----Link: " + xp.getLink().trim());
                    System.out.println("----Summary: " + xp.getSummary().trim());
                    System.out.println("----Img: " + xp.getImg());
                    System.out.println("================================================");
                }
                i++;
            } catch (Exception e) {
            }
        }

    }
}
